ODSemanticInterface
- Superclasses
ODExtension
-->ODRefCntObject
-->ODObject
- Subclasses
- none
An object of the
ODSemanticInterface
class implements an extension that handles semantic events for your part. It is recommended, but not required, that your part editor support this extension.Description
When a document is opened, the session object creates a single semantic interface object for the document shell. All parts of that document share the document shell's semantic interface object; you can obtain a reference to it by calling the session object'sAcquireShellSemtInterface
method (page 605).The methods defined by the
ODSemanticInterface
class parallel handlers and functions defined for Apple events in Inside Macintosh: Interapplication Communication. The following information assumes a basic knowledge of handling Apple events and resolving object specifiers.The
ODSemanticInterface
class is designed to respond to semantic events received by your part. Because OpenDoc is responsible for dispatching semantic events to your part, many of the handlers that would normally be defined by multiple functions using the Apple Event Manager are grouped conceptually in theODSemanticInterface
class. For example, theCallEventHandler
method (page 590) provides a bottleneck that all Apple events sent to your part must go through.The methods of this class consist of four types: semantic-event handlers, object accessors, object-callback functions, and other handlers. OpenDoc calls the semantic-event handlers of your subclass to handle Apple events intended for your part. The object accessors and object-callback functions are used by OpenDoc to resolve object specifiers for your part. OpenDoc calls other handlers for special purposes. Your implementation of these methods can consist of separate handlers or a single large procedure that handles all of your part's semantic events.
The
ODSemanticInterface
class is an abstract superclass that you must subclass to create your semantic interface. OpenDoc accesses your semantic interface object by calling your part'sAcquireExtension
method (page 466), which returns a reference to the extension object. The semantic-interface extension type is identified by the constantkODExtSemanticInterface
. If your part supports this extension, your part subclass must override theAcquireExtension
,HasExtension
, andReleaseExtension
methods and provide an appropriate implementation. For more information related to extension objects, see theODExtension
class description (page 212).For more information about creating and sending Apple events to other parts, see the
ODMessageInterface
class description (page 411). For more information related to resolving object specifiers, see theODNameResolver
class description (page 419) and the "Resolving and Creating Object Specifier Records" chapter of Inside Macintosh: Interapplication Communication. For more information related to Apple event and coercion handlers, see the "Responding to Apple Events" chapter of Inside Macintosh: Interapplication Communication. For general information on scripting support in OpenDoc, see the chapter on semantic events and scripting in theOpenDoc Programmer's Guide for the MacOS . Overriding Inherited Methods
The following methods are inherited and available for use by your subclass ofODSemanticInterface
.somInit
ThesomInit
method initializes the instance variables in a SOM object; it is inherited from theSOMObject
class.If you subclass
ODSemanticInterface
, you can override this method. Your override method does not need to call its inherited method; the inherited method is automatically called for you by the SOM library.Your override of this method should initialize the new instance variables in this semantic interface object. The SOM library calls this method when this semantic interface object is created. You must not do anything that might fail in this method. This limits you to operations like setting pointer variables to null, setting numeric variables to appropriate values, and making similar assignments from constants. If you have any initialization code that can potentially fail, it must be handled in this semantic interface object's subclass-specific initialization method; see also the
InitSemanticInterface
method (page 598).somUninit
ThesomUninit
method disposes of the storage created for a SOM object; it is inherited from theSOMObject
class.If you subclass
ODSemanticInterface
, you can override this method. Your override method does not need to call its inherited method; the inherited method is automatically called for you by the SOM library.Your override of this method should dispose of any storage created for this semantic interface object, including any storage related to additional instance variables initialized in this semantic interface object. The SOM library calls this method when this semantic interface object is deleted; this method must not fail.
Release
TheRelease
method decrements an object's reference count by 1; it is inherited from theODRefCntObject
class.
void Release ();If you subclassODSemanticInterface
, you can override this method to release an object and reclaim valuable resources like memory. Your override method must call its inherited method at the beginning of your implementation.The inherited
Release
method decrements this semantic interface object's reference count by 1. The inherited method may delete this semantic interface object from memory if this object's reference count becomes 0. A part editor calls this method when it no longer needs a reference to this semantic interface object.Purge
ThePurge
method frees memory on request; it is inherited from theODObject
class.
ODSize Purge (in ODSize size);Every subclass ofODObject
can override this method and should do so if it creates caches and temporary buffers. If you subclassODSemanticInterface
, you must override this method or risk running out of available memory. Your override method must call its inherited method at some point in your implementation (it does not matter where). You should save the size value returned by the inherited method because you will need it to compute the value to return from your override method.Your override of this method should free any caches, noncritical buffers, or objects (up to the amount of memory specified). Your override of this method should add the number of bytes actually freed to the number returned by the inherited method and return the sum as the total amount of memory released. OpenDoc calls this method in low-memory situations; you should not allocate memory for this operation.
Methods
This section presents summary descriptions of theODSemanticInterface
methods grouped according to purpose, followed by detailed descriptions in alphabetical order.Initializing
Semantic-Event Handlers
InitSemanticInterface
- Initializes this semantic interface object.
Object Accessors
CallEventHandler
- Processes the specified Apple event object for the part.
Object-Callback Functions
CallObjectAccessor
- Resolves the object specifier into a target and returns a reference to an OpenDoc token identifying that target.
Other Handlers
CallCountProc
- Counts the number of elements of the specified type in the specified container.
CallCompareProc
- Compares two descriptors.
CallGetMarkTokenProc
- Gets the mark token to use for marking a large series of objects.
CallMarkProc
- Marks a large series of objects using the specified mark token.
CallAdjustMarksProc
- Unmarks a series of objects that were previously marked.
CallDisposeTokenProc
- Deallocates any part-specific data structures stored in the specified token.
CallGetErrDescProc
- Gets a reference to the part's global error descriptor object.
OSL Settings
CallCoercionHandler
- Coerces the specified descriptor to a different type.
CallPredispatchProc
- Calls the predispatch handler for this semantic interface's part.
UsingPredispatchProc
- Specifies whether the predispatch method is currently being called whenever OpenDoc receives an Apple event.
GetOSLSupportFlags
- Returns the flags that indicate which handlers this semantic interface object supports.
SetOSLSupportFlags
- Sets the flags that indicate which handlers this semantic interface object supports.
Methods
CallAdjustMarksProc
CallCoercionHandler
CallCompareProc
CallCountProc
CallDisposeTokenProc
CallEventHandler
CallGetErrDescProc
CallGetMarkTokenProc
CallMarkProc
CallObjectAccessor
CallPredispatchProc
GetOSLSupportFlags
InitSemanticInterface
SetOSLSupportFlags
UsingPredispatchProc
Main | Page One | What's New | Apple Computer, Inc. | Find It | Contact Us | Help